// 解析 Range 请求头
function parseRange(rangeHeader, fileSize) {
    const parts = rangeHeader.replace(/bytes=/, '').split('-');
    const start = parseInt(parts[0], 10);
    const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
  
    return { start, end };
}

function waitTime(time = 2000){
    return new Promise(resolve => {
        setTimeout(() => {
            resolve();
        }, time);
    })
}

module.exports = {
    parseRange,
    waitTime
}